package com.ys.erp.common.util;

import java.util.Random;

/**
 * @Author: lwj
 * @Date: 2024/11/5
 */
public class ColorUtil {

    private static final Random RANDOM = new Random();

    /**
     * Generates a random hex color code with a specified brightness range
     * to ensure a visually appealing color.
     *
     * @return A random color code in the format #RRGGBB.
     */
    public static String generateRandomColor() {
        int red = getRandomValueInRange();
        int green = getRandomValueInRange();
        int blue = getRandomValueInRange();

        return String.format("#%02X%02X%02X", red, green, blue);
    }

    /**
     * Generates a random integer within a specified range.
     *
     * @return A random integer between min and max.
     */
    private static int getRandomValueInRange() {
        return 50 + RANDOM.nextInt(200 - 50 + 1);
    }

}
